<ui:composition template="/WEB-INF/templates/layout.xhtml"
                xmlns="http://www.w3.org/1999/xhtml"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:p="http://primefaces.org/ui"
        >
    <ui:define name="content">
        <h:form id="forminforme">
            <p:growl autoUpdate="true"/>

            <p:panel style="width: 800px; height: 640px;border: none;">
                <h:panelGrid columns="3">
                    <p:selectOneMenu id="report" styleClass="report_select" value="#{reportEditorController.report}">
                        <f:selectItem itemLabel="Selecccione un reporte" itemValue="" />
                        <!--
                        <f:selectItem itemLabel="Alumnos - Listar factura" itemValue="reporteFactura" />
                        -->
                        <f:selectItem itemLabel="Alumnos - Listar factura" itemValue="resporteFacturaArenal"/>
                        <f:selectItem itemLabel="Vehículos - Listar mantenimiento vehiculos" itemValue="reporteMtoVehiculo"/>
                        <f:selectItem itemLabel="Proveedores - Facturar" itemValue="reporteProveedor" />
                        <f:selectItem itemLabel="DGT - Examen Práctico" itemValue="resporteExamenPractico"/>
                        <f:selectItem itemLabel="DGT - Examen Teórico" itemValue="resporteExamenTeorico"/>
                    </p:selectOneMenu>
                    <!--
                    <p:selectOneMenu id="reports" style="width: 249px" styleClass="report_select">
                        <f:selectItem itemLabel="Select One"/>

                        <f:selectItem itemLabel="turnover of students" itemValue="resporteFacturaArenal"/>
                        <f:selectItem itemLabel="Report invoices students" itemValue="reporteFacturaLote"/>
                        <f:selectItem itemLabel="Vehicle maintenance" itemValue="reporteMtoVehiculo"/>


                        <f:selectItem itemLabel="Suppliers, report invoice" itemValue="reporteProveedorLote"/>

                        DGT, theoretical examination

                        <f:selectItem itemLabel="Factura" itemValue="reporteFactura"/>

                        <f:selectItem itemLabel="Movimiento" itemValue="reporteMovimiento"/>

                        <f:selectItem itemLabel="Proveedor" itemValue="reporteProveedor"/>


                        <f:selectItem itemLabel="ExamenPractico" itemValue="resporteExamenPractico"/>
                        <f:selectItem itemLabel="ExamenTeorico" itemValue="resporteExamenTeorico"/>

                    </p:selectOneMenu>
                    -->
                    <p:button onclick="loadReportForEdit(); return false;" value="Editar"/>
                    <p:button value="Guardar" onclick="saveReport(rootCtx); return false;"/>
                </h:panelGrid>
                <br></br>

                <!--<p:scrollPanel>-->
                    <div style="position:absolute; width:780px; height: 560px; overflow: scroll;">
                        <div id="reportContainer" class="report_paper">
                            <div id="reportDiv"
                                 style="position:absolute; width: 800px; height: 1000px; background-color: #FFFFFF; border: 1px dashed #DDAADD;">

                            </div>
                        </div>
                    </div>
                <!--</p:scrollPanel>-->
            </p:panel>
            <script type="text/javascript">

                var rootCtx = '#{request.contextPath}';
                
                function loadReportForEdit() {
                    var rpt = $('.report_select option:selected').val();
                    console.log("rootCtx: " + rootCtx);
                    console.log("rpt:" + rpt);
                    loadReport(rootCtx, rpt);
                }

            </script>
            <p:remoteCommand name="updateMessage" process="@this" action="#{reportEditorController.afterSave}" update="@this" >
            </p:remoteCommand>
        </h:form>
    </ui:define>
</ui:composition>